//
//  UIViewController+LoginHold.m
//  PPDL
//
//  Created by 王洋 on 2019/8/27.
//  Copyright © 2019 王洋. All rights reserved.
//

#import "PPLoginViewController.h"
#import "PPNavigationViewController.h"
#import "UIViewController+LoginHold.h"

@implementation UIViewController (LoginHold)

- (void)openLoginWithCompletion:(TTOpenLoginCompletionBlock)completion{
    if ([[TTUserModel sharedObject] isLogged]) {
        completion(YES,@{});
        return;
    }
    
    PPLoginViewController* login = [[PPLoginViewController alloc] init];
    login.completion = completion;
    PPNavigationViewController *navController = [[PPNavigationViewController alloc] initWithRootViewController:login];
    [navController.navigationBar setTranslucent:false];
    navController.navigationBar.barTintColor = [UIColor whiteColor];
    UIViewController *spVc = self.navigationController? self.navigationController: self;
    navController.modalPresentationStyle = UIModalPresentationFullScreen;
    [spVc presentViewController:navController animated:YES completion:nil];
}

@end
